import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 需要和服务端建立TCP连接通道
client.connect(("127.0.0.1",40000))
# 客户端给服务端发送数据
client.send("你好".encode("utf-8"))

client.close()